﻿<!-- Phan khai bao bien cuc bo-->
<?php
$v_record_id = 0;
if(isset($_REQUEST['hdn_record_id'])){
	$v_record_id = intval($_REQUEST['hdn_record_id']);
}
$v_recordtype_filter = $_SESSION['onegate_current_recordtype'];
if ($v_idea_id >0) {
	$v_idea_id = $arr_single_idea['PK_IDEA'];
	$v_suggester_id = $arr_single_idea['FK_SUGGESTER'];
	$v_date = _yyyymmdd_to_ddmmyyyyhhmmss($arr_single_idea['C_DATE']); 
	$v_content = _replace_bad_char($arr_single_idea['C_CONTENT']); 
	$v_file_name = $arr_single_idea['C_FILE_NAME'];
	$v_readonly = "readonly";
	$v_display = "block";
}else{
	$v_idea_id = 0;
	$v_date = date('d/m/Y h:m:s');
	$v_content = "";
	$v_readonly = "";
	$v_display = "none";
	$v_file_name = "";
}
$v_file_url = trim(CONST_URL_PATH_FROM_ROOT) . $v_file_name;
$v_goto_url = "javascript:filename_onclick('T_ONEGATE_IDEA', 'PK_IDEA', 'C_FILE_NAME', 'C_FILE_CONTENT'," . strval($v_idea_id) . ",'" . $v_file_url ."');" ;
?>
<!--bang chua tieu de cua form-->
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="large_title"><?php
	if ($v_idea_id <= 0){?>
		<td><?php echo CONST_IDEA_UPDATE_TITLE; ?></td><?php
	}else{?>
		<td><?php echo CONST_IDEA_TITLE; ?></td><?php
	}?>	
	</tr>
</table>
<!-- Bat cac phim: F12=true; Insert=false; Delete=false, ESC=true; Enter=true -->
<div id="hotkey" onKeyDown="javascript:process_hot_key(true,false,false,true,true);">
<!--bang chua cac text box de nhap du lieu-->
<table width="100%" class="form_table1" cellpadding="0" cellspacing="0" border="0">
	<col width="18%"><col width="82%">
	<tr>
		<form action="index.php" method="post" name="f_dsp_single_idea" enctype= "multipart/form-data">
		<input type="hidden" name="fuseaction" value="UPDATE_IDEA" >
		<input type="hidden" name="hdn_idea_id" value="<?php echo $v_idea_id;?>" >
		<input type="hidden" name="hdn_record_id"  value="<?php echo $v_record_id; ?>">
		<input type="hidden" name="hdn_recordtype_filter" value="<?php echo $v_recordtype_filter; ?>">
	</tr>
	<tr>
		<td colspan="10"><?php echo onegate_show_record_general_info($arr_single_record,$_SESSION['recordtype'],true,$p_petition_link,$p_rate_of_progress_link,$p_document_link,$p_idea_link,$p_sign_link,$p_approve_link,$p_licensing_link,$v_url_view_update_record_status); ?></td>
	</tr>
	<tr>
		<td colspan="5" ><hr color="#66CCFF" size="1"></td>
	</tr>
	<tr style="display:<?php echo $v_display;?> ">
		<td align="left" class="normal_label"><?php echo CONST_IDEA_DATE_LABEL.":";?></td>
		<td><input type="text"  style="width:26%" name="txt_date"  readonly="true" class="normal_date_textbox" optional="<?php echo CONST_DATE_OPTIONAL; ?>" value="<?php echo $v_date; ?>" onKeyDown="change_focus(document.forms(0),this);"></td>
	</tr>
	<tr>
		<td class="normal_label" valign="top"><?php echo CONST_IDEA_CONTENT_LABEL.":";?><small class="normal_starmark">*</small></td>
		<td><textarea name="txt_content" <?php echo $v_readonly;?> style="width:100% " class="normal_textarea" value="" rows="3" message="<?php echo CONST_IDEA_CONTENT_MESSAGE; ?>" optional="<?php echo CONST_IDEA_CONTENT_OPTIONAL; ?>"><?php echo $v_content ; ?></textarea></td>
	</tr><?php
	if (($v_idea_id > 0) && ($v_file_name <> "")){?>
	<tr>
		<td class="normal_label"><?php echo CONST_ATTACH_FILE_LABEL.":"; ?></td>
		<td class="normal_label" align="left">
			<a href="<? echo $v_goto_url; ?>" class="normal_link"><? echo $v_file_name;?></a>
		</td>
	</tr><?php
	}else if (($v_idea_id <= 0) && ($v_file_name == "")){?>
	<tr>
		<td class="normal_label"><?php echo CONST_ATTACH_FILE_LABEL.":"; ?></td>
		<td>
			<input type="file" name="file_attach" style="width:100%" class="small_textbox" message="<?php echo CONST_ATTACH_FILE_MESSAGE;?>" onKeyDown="change_focus(document.forms(0),this)">
		</td>
	</tr><?php
	}?>
</table>
<!--bang chua cac button-->
<table width="100%" >
	<tr>
		<td align="center" width="100%" height="40" valign="bottom"><?php
			if ($v_idea_id <=0){?>
			<input type="button" name="btn_save"  class="normal_button" value="<?php echo _CONST_SAVE_BUTTON;?>" onClick="btn_save_onclick('UPDATE_IDEA');" onKeyDown="change_focus(document.forms(0),this)"><?php
			}?>
			<input type="button" name="btn_back" class="normal_button" value="<?php echo _CONST_BACK_BUTTON;?>" onClick="btn_back_onclick('<?php echo $_GO_BACK?>')" onKeyDown="change_focus(document.forms(0),this)">
		</td>
	</tr>
</table>					
</div>
</form>
<script language="JavaScript">
	set_focus(document.forms(0));
	window.dialogHeight = "340pt";
	window.dialogWidth = "420pt";
	window.dialogTop = "80pt";
</script>
